package com.wuzheng.wisgo.sanitation.cloud.enums;


import java.io.Serializable;

/**
 * @MethodName: InfixDataEnum
 * @Description: 新增修改枚举类型
 * @Author: sunpeng
 * @Date: 2019/10/9
 **/
public enum InfixDataEnum implements Serializable {
    ADD("add", "新增"),
    UPDATE("update", "修改");

    private final String typeId;
    private final String typeDesc;

    public String getTypeId() {
        return typeId;
    }

    public String getTypeDesc() {
        return typeDesc;
    }

    InfixDataEnum(String typeId, String typeDesc) {

        this.typeId = typeId;
        this.typeDesc = typeDesc;
    }

    /**
     * 根据method返回枚举类型,主要在switch中使用
     *
     * @param typeCode
     * @return
     */
    public static InfixDataEnum getByTypeCode(String typeCode) {
        for (InfixDataEnum code : values()) {
            if (code.getTypeId() == typeCode) {
                return code;
            }
        }
        return null;
    }
}
